<?php



/**
 * 注册用户打卡
 * Enter description here ...
 * @author Admin
 *
 */
class PunchModel extends CommonModel {
	
	
	/**
	 * 注册用户打卡状态
	 * Enter description here ...
	 * @param unknown_type $uid
	 */
	public function isPunch($uid){
		$starttime = strtotime(date('Y-m-d',time()));
		$endtime = $starttime + 86400;
		$map = array(
			'uid' => array('eq',$uid),
			'addtime' => array('between',"{$starttime},{$endtime}"),
		);
		$data = $this->where($map)->find();
		if(empty($data)){
			return false;
		}else{
			return true;
		}
	}

	
	/**
	 * 注册用户打卡
	 * Enter description here ...
	 * @param unknown_type $uid
	 * @param unknown_type $uname
	 */
	public function punching($uid,$uname){
		$data = array(
			'uid' => $uid,
			'name'=>$uname,
			'addtime'=>time(),
		);
		return $this->add($data);
	}
	
	
	
}

?>